// import com.alibaba.druid.sql.ast.SQLExpr_ptr;
// import com.alibaba.druid.sql.ast.SQLName;
// import com.alibaba.druid.sql.ast.SQLStatementImpl;
// import com.alibaba.druid.sql.visitor.SQLASTVisitor;

// import java.util.ArrayList;
// import java.util.List;

#include "SQLCopyFromStatement.h"
#include "../../visitor/SQLASTVisitor.h"
#include "../../../utils/listTran.h"
#include "SQLExprTableSource.h"
#include "SQLAssignItem.h"

SQLCopyFromStatement::SQLCopyFromStatement()
{
  columns = std::make_shared<std::list<SQLName_ptr>>();
  options = std::make_shared<std::list<SQLAssignItem_ptr>>();
  partitions = std::make_shared<std::list<SQLAssignItem_ptr>>();
}
// @Override
void SQLCopyFromStatement::accept0(SQLASTVisitor_ptr v)
{
  if (v->visit(SharedObject(SQLCopyFromStatement)))
  {
    acceptChild(v, table);
    SQLObject_list_ptr tmp1 = ListTran::tran_class<SQLName, SQLObject>(columns);
    acceptChild(v, tmp1);
    SQLObject_list_ptr tmp2 = ListTran::tran_class<SQLAssignItem, SQLObject>(partitions);
    acceptChild(v, tmp2);
    acceptChild(v, from);
    SQLObject_list_ptr tmp3 = ListTran::tran_class<SQLAssignItem, SQLObject>(options);
    acceptChild(v, tmp3);
  }
  v->endVisit(SharedObject(SQLCopyFromStatement));
}

SQLExprTableSource_ptr SQLCopyFromStatement::getTable()
{
  return table;
}

void SQLCopyFromStatement::setTable(SQLExprTableSource_ptr x)
{
  if (x != nullptr)
  {
    x->setParent(SharedObject(SQLCopyFromStatement));
  }
  this->table = x;
}

SQLName_list_ptr SQLCopyFromStatement::getColumns()
{
  return columns;
}

SQLExpr_ptr SQLCopyFromStatement::getFrom()
{
  return from;
}

void SQLCopyFromStatement::setFrom(SQLExpr_ptr x)
{
  if (x != nullptr)
  {
    x->setParent(SharedObject(SQLCopyFromStatement));
  }
  this->from = x;
}

SQLExpr_ptr SQLCopyFromStatement::getAccessKeyId()
{
  return accessKeyId;
}

void SQLCopyFromStatement::setAccessKeyId(SQLExpr_ptr x)
{
  if (x != nullptr)
  {
    x->setParent(SharedObject(SQLCopyFromStatement));
  }
  this->accessKeyId = x;
}

SQLExpr_ptr SQLCopyFromStatement::getAccessKeySecret()
{
  return accessKeySecret;
}

void SQLCopyFromStatement::setAccessKeySecret(SQLExpr_ptr x)
{
  if (x != nullptr)
  {
    x->setParent(SharedObject(SQLCopyFromStatement));
  }
  this->accessKeySecret = x;
}

SQLAssignItem_list_ptr SQLCopyFromStatement::getOptions()
{
  return options;
}

SQLAssignItem_list_ptr SQLCopyFromStatement::getPartitions()
{
  return partitions;
}
